package com.kmxd.ams.core.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 数据校验分组常量
 *
 * @author nickbi
 */
@Getter
@AllArgsConstructor
public enum SecureEnum {
  /** md5 */
  MD5("MD5"),
  /** sm1 */
  SM1("SM1"),

  SM2("SM2"),
  SM3("SM3"),
  SM4("SM4"),

  SHA1("sha1"),

  SHA256("sha256"),

  RSA("rsa"),

  AES("aes"),
  ;
  private String type;

  public static SecureEnum convert(String name) {
    return Arrays.stream(values())
        .filter(x -> x.type.equalsIgnoreCase(name))
        .findAny()
        .orElse(null);
  }
}
